package com.example.demo;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.env.Environment;
import org.springframework.jms.core.JmsMessagingTemplate;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.Map;

/**
 * Created by 敲代码的卡卡罗特
 * on 2018/6/20 22:52.
 */
@RestController
public class Test {
    @Autowired
    private JmsMessagingTemplate jmsMessagingTemplate;
    @Autowired
    private Environment environment;
    @RequestMapping("/send")
    public void send(String text){
        System.out.println(environment.getProperty("spring.activemq.broker-url"));
        jmsMessagingTemplate.convertAndSend("itcast", text);
    }


    @RequestMapping("/sendmap")
    public void sendMap(){
        Map map=new HashMap<>();
        map.put("mobile", "13683391759");
        map.put("template_code", "SMS_86640114");
        map.put("sign_name","黑马");
        map.put("param", "{\"name\":\"小蔡\"}");

        jmsMessagingTemplate.convertAndSend("itcast_map", map);
    }
}
